package com.demo.webapp.ui.table;

import java.util.List;

import com.demo.core.dao.base.support.PageSupport;
import com.demo.webapp.ui.Component;

/**
 * Table组件容器
 * @author ryuu.kk
 *
 */
public class TableComponent implements Component {

	/**
	 * 版本序列化ID
	 */
	private static final long serialVersionUID = 3777226624915084005L;
	
	/**
	 * 组件是否持久存储
	 * 0:持久存储
	 */
	public static final int COMONENT_STATIC = 0;
	
	/**
	 * 组件是否持久存储
	 * 1:瞬时存储
	 */
	public static final int COMPONENT_INSTANT = 1;
	
	/**
	 * 组件类型:table类型
	 */
	public static final String COMPONENT_TYPE = "table";
	
	// 唯一性标识
	private String id;
	// 组件名
	private String name;
	// Action中的数据属性名(由taglibs中指定)
	private String property;
	// 组件类型:table
	private String type = COMPONENT_TYPE;
	// 组件数据
	private Object source;
	// 组件基础地址
	private String baseUri;
	// 组件存储状态(默认持久存储)
	private int status = COMONENT_STATIC;
	// Column容器列表
	private List<ColumnComponent> columnList;
	
	// ~附加信息 ：①、分页--------------------------------------------------
	// 是否分页
	private boolean isPage;
	// 分页大小
	private int pagesize;
	// 分页地址
	private String page;
	// ajax分页
	private boolean ajaxPage = false;
	// ajax分页渲染点
	private String renderTo;
	// 页面load后或ajax分页显然后的js调用
	private String onLoad;
	//当前页,最大显示条数,总页数,分页类型
	private PageSupport pageSupport;
	
	public PageSupport getPageSupport() {
		return pageSupport;
	}

	public void setPageSupport(PageSupport pageSupport) {
		this.pageSupport = pageSupport;
	}
	
	// ~附加信息 ：②、排序--------------------------------------------------
	private boolean sort;
	
	@Override
	public String getId() {
		return id;
	}
	
	@Override
	public String getUrl() {
		return getBaseUri();
	}
	
	@Override
	public String getName() {
		return name;
	}
	
	@Override
	public String getType() {
		return type;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	public String getBaseUri() {
		return baseUri;
	}
	
	public void setBaseUri(String baseUri) {
		this.baseUri = baseUri;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public boolean isPage() {
		return isPage;
	}

	public void setPage(boolean isPage) {
		this.isPage = isPage;
	}

	public boolean getSort() {
		return sort;
	}

	public void setSort(boolean sort) {
		this.sort = sort;
	}

	public void setType(String type) {
		this.type = type;
	}

	public List<ColumnComponent> getColumnList() {
		return columnList;
	}

	public void setColumnList(List<ColumnComponent> columnList) {
		this.columnList = columnList;
	}

	public Object getSource() {
		return source;
	}

	public void setSource(Object source) {
		this.source = source;
	}

	public void setPerperty(String property) {
		this.property = property;
	}

	public String getProperty() {
		return property;
	}

	public void setProperty(String property) {
		this.property = property;
	}

	public int getPagesize() {
		return pagesize;
	}

	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}

	public String getPage() {
		return page;
	}

	public void setPage(String page) {
		this.page = page;
	}

	public boolean isAjaxPage() {
		return ajaxPage;
	}

	public void setAjaxPage(boolean ajaxPage) {
		this.ajaxPage = ajaxPage;
	}

	public String getOnLoad() {
		return onLoad;
	}

	public void setOnLoad(String onLoad) {
		this.onLoad = onLoad;
	}

	public String getRenderTo() {
		return renderTo;
	}

	public void setRenderTo(String renderTo) {
		this.renderTo = renderTo;
	}
}
